package com.clothes.aweiDoExercises.service;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.baomidou.mybatisplus.extension.service.IService;
import com.clothes.aweiDoExercises.common.BaseResponse;
import com.clothes.aweiDoExercises.model.dto.post.PostQueryRequest;
import com.clothes.aweiDoExercises.model.dto.question.QuestionQueryRequest;
import com.clothes.aweiDoExercises.model.entity.Post;
import com.clothes.aweiDoExercises.model.entity.Question;
import com.clothes.aweiDoExercises.model.entity.User;
import com.clothes.aweiDoExercises.model.vo.QuestionVO;

import javax.servlet.http.HttpServletRequest;
import java.util.List;

/**
 * 题目服务
 *
 * @author <<a href="www.yclothes.top">阿伟智能面试刷题平台</a>">clothes</a>
 * @from <a href="https://www.code-nav.cn">阿伟智能刷题学习平台</a>
 */
public interface QuestionService extends IService<Question> {

    /**
     * 校验数据
     *
     * @param question
     * @param add 对创建的数据进行校验
     */
    void validQuestion(Question question, boolean add);

    /**
     * 获取查询条件
     *
     * @param questionQueryRequest
     * @return
     */
    QueryWrapper<Question> getQueryWrapper(QuestionQueryRequest questionQueryRequest);
    
    /**
     * 获取题目封装
     *
     * @param question
     * @param request
     * @return
     */
    QuestionVO getQuestionVO(Question question, HttpServletRequest request);

    /**
     * 分页获取题目封装
     *
     * @param questionPage
     * @param request
     * @return
     */
    Page<QuestionVO> getQuestionVOPage(Page<Question> questionPage, HttpServletRequest request);

    /**
     * 分页获取题目列表（仅管理员可用）
     * 根据题库id查询题目列表
     * @param questionQueryRequest
     * @return
     */
    Page<Question> listQuestionByPage(QuestionQueryRequest questionQueryRequest);


    /**
     * 从 ES 查询题目
     *
     * @param questionQueryRequest
     * @return
     */
    Page<Question> searchFromEs(QuestionQueryRequest questionQueryRequest);

    /**
     * 批量删除题目
     * @param questionList
     */
    void batchDeleteQuestions(List<Long> questionList);

    /**
     * AI 生成题目
     * @param questionType 题目类型比如Java
     * @param questionCount 题目数量比如 10
     * @return true或者false
     */
    boolean aiGenerateQuestion(String questionType, int questionCount, User user);


    /**
     * 查询题目标签
     * @return
     */
    List<String> getTags();
}
